//
//  GCAVPlayer.h
//  GC_OC
//
//  Created by 叶建辉 on 2022/6/9.
//

#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>
#import "ICMusicPlayModel.h"
#import "ICMusicPlayNarrowView.h"
#import "Reachability.h"
#import <MediaPlayer/MediaPlayer.h>
#import "NSDictionary+safeAssignment.h"
#import "NSString+safeAssignment.h"
#import "NSArray+safeAssignment.h"
#import "SqliteHelp.h"
#import "ObjectAFNetWorking.h"
#import "JHPropressView.h"
#import "toolHelp.h"
#import "UIImage+SVG.h"
#import "PlayMulitplePopView.h"
#import "PlayListView.h"
#import "PlayCountDownView.h"
#import "Cache.h"
#import "UIViewController+Utility.h"
#import "UIWindow+Utility.h"
#import "LoginViewController.h"
NS_ASSUME_NONNULL_BEGIN

typedef enum : NSUInteger {
    playTypeSequence = 0, //顺序播放
    playTypeSingle = 1,   //单曲循环播放
    playTypeRandom = 2,   //随机播放
} playType;

@protocol GCAVPlayerDelegate <NSObject>

@required



@optional
//播放结束
-(void)playEnd;
//开始缓存
-(void)startCache;
//开始播放
-(void)startPlay;
//缓存进度 播放进度
-(void)cacheProgress:(float)cp playProgress:(float)pp;

-(void)isPlay:(BOOL)isplay;

-(void)playforMedia_id:(NSString *)media_id;

@end


@interface GCAVPlayer : UIView

+ (GCAVPlayer *)shared;

@property(nonatomic,strong)AVPlayer *player;

@property (nonatomic ,readonly) AVPlayerLayer *playerLayer;

@property(nonatomic,strong)NSArray *listDatas;

@property (nonatomic ,weak) id <GCAVPlayerDelegate> delegate;
//播放下标
@property (nonatomic,assign)NSInteger index;
//倍速播放
@property (nonatomic,assign)float gc_rate;
//播放模式
@property (nonatomic, assign) playType playStyle;

@property(nonatomic,strong)NSString *media_id;

@property (nonatomic ,assign) ViewShowState vsstate;

@property (nonatomic,assign)float proproress;

@property (nonatomic,assign)float cacheproress;

@property(nonatomic,strong)NSString *endtimestr;

@property(nonatomic,strong)NSString *starttimestr;

@property(nonatomic,assign)BOOL isAudio;

@property(nonatomic,assign)BOOL iscollect;

@property (nonatomic ,assign) float videoLength;

-(void)retreatQuickly;

-(void)fastForward;

-(void)pause;

-(void)play;

-(void)nextPlay;

-(void)lastPlay;

-(void)play:(NSArray *)resArr andindex:(NSInteger)index ViewStatue:(NSInteger)type andIsAudio:(BOOL)isaudio;

-(void)playIndex:(NSInteger)index;

-(void)playVideoIndex:(NSInteger)index;

-(void)seekToTime:(NSTimeInterval)progress completionHandler:(void (^ __nullable)(BOOL finished))completionHandler;

-(void)showpppLoginplayer;
@end

NS_ASSUME_NONNULL_END
